home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / T-Z / VideoStakGold.cpt / VideoStakGold / VideoStak ◊ Begin Here / stack.txt < prev   
Text File  |  1988-04-27  |  15KB  |  589 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2659
  12. -- card count: 329
  13. -- first card id: 3199
  14. -- list block id: 30388
  15. -- print block id: 5117
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 2
  19. -- free size: 69024 bytes
  20. -- total size: 409600 bytes
  21. -- stack block size: 18944 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x00000000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68.  
  69. ------------------------------------------
  70. -- STACK SCRIPTS CONSISTING OF OPENERS, --
  71. -- CLOSERS, IDLERS, DOMENUS & KEYTRAPS. --
  72. ------------------------------------------
  73.  
  74. -------------------
  75. -- OPENING STUFF --
  76. -------------------
  77.  
  78. On OPENSTACK
  79.  
  80.   -- SHOW WATCH & DECLARE GLOBALS:
  81.   set cursor to 4
  82.   global PK,UL,TA,BT,MW,master,titleMaster,starMaster
  83.   global directorMaster,classMaster,labelMaster,window
  84.   global installBtn,lineNo,cardNo,hiButton
  85.  
  86.   -- RECORD PREVIOUS STATUS & ADVISE OF DELAY:
  87.   go to card "Opening"
  88.   put "Loading the indices. This takes a few seconds..."
  89.   put the powerKeys into PK
  90.   put the userLevel into UL
  91.   put the textArrows into TA
  92.   put the blindTyping into BT
  93.   hide menuBar
  94.  
  95.   -- ADJUST THE LOCK/UNLOCK MODALITIES:
  96.   if the short name of bg btn id 153 = "Edit ON" then
  97.     -- UNLOCK MODE:
  98.     lock screen
  99.     set the icon of bg btn id 153 to 1413
  100.     unlock screen
  101.     set name of bg btn id 153 to "Edit ON"
  102.     set powerKeys to true
  103.     set userlevel to 1
  104.   else
  105.     -- LOCK MODE:
  106.     lock screen
  107.     set the icon of bg btn id 153 to 13262
  108.     unlock screen
  109.     set name of bg btn id 153 to "Edit OFF"
  110.     set powerKeys to false
  111.     set userlevel to 5
  112.   end if
  113.  
  114.   -- PUT LAST SESSION'S DATA INTO VARIABLES:
  115.   put card field "Master" into master
  116.   put card field "titleMaster" into titleMaster
  117.   put card field "starMaster" into starMaster
  118.   put card field "directorMaster" into directorMaster
  119.   put card field "classMaster" into classMaster
  120.   put card field "installBtn" into installBtn
  121.   put card field "labelMaster" into fld "Label"
  122.   put card field "labelMaster" into labelMaster
  123.   put card field "lineNo" into lineNo
  124.   put card field "cardNo" into cardNo
  125.   put card field "hiButton" into hiButton
  126.   send mouseUp to bkgnd btn hiButton
  127.   put fld "Window" into window
  128.  
  129.   -- WARM UP OPENING CARDS:
  130.   lock screen
  131.   set lockmessages to true
  132.   go to card "Credits"
  133.   go to card cardNo
  134.   if labelMaster ‚↠empty or labelMaster ‚↠return then
  135.     put labelMaster into fld "Label"
  136.   end if
  137.   if window ‚↠empty then put window into fld "Window"
  138.   put item 2 of the abbrev date into field "Date"
  139.   go to card "Opening"
  140.  
  141.   -- GO THROUGH OPENING SEQUENCE (LOCKS STILL ON!):
  142.   if cardNo < "3" then put "3" into cardNo
  143.   set cursor to 4
  144.   go to card "Credits"
  145.   play TVstart
  146.   unlock screen with visual dissolve fast
  147.   put empty
  148.   hide msg
  149.   wait 15 ticks
  150.   lock screen
  151.   go to card cardNo
  152.   play drawer
  153.   unlock screen with visual dissolve fast
  154.   set lockmessages to false
  155.  
  156. End OPENSTACK
  157.  
  158. ------------------
  159. -- MORE OPENING --
  160. ------------------
  161.  
  162. On OPENCARD
  163.  
  164.   -- DECLARE GLOBALS:
  165.   global window,labelMaster
  166.  
  167.   -- FILL IN THOSE CONTAINERS IN NEED OF NEW DATA:
  168.   if window ‚↠empty then
  169.     put window into field "Window"
  170.   end if
  171.   if labelmaster ‚↠empty then
  172.     put labelMaster into field "Label"
  173.   end if
  174.   put item 2 of the abbrev date into field "Date"
  175.   unlock screen with visual dissolve fast
  176.  
  177. End OPENCARD
  178.  
  179. -----------------------
  180. -- TRAPPING HANDLERS --
  181. -----------------------
  182.  
  183. On IDLE
  184.  
  185.   -- DECLARE GLOBALS:
  186.   global SEEKING,listOscrolls,master,hiTapeButton
  187.   global hiButton,lineNo
  188.  
  189.   -- DO THE EDIT THING:
  190.   if the optionKey is down and the commandKey is down then
  191.     if the short name of bg btn id 153 = "Edit OFF" then
  192.       pass idle
  193.     end if
  194.     send mouseUp to bg btn id 153
  195.     exit idle
  196.   end if
  197.  
  198.   -- CHECK INDEX; MAKE SURE NOT EMPTY:
  199.   if fld "Window" = empty then
  200.     if master ‚↠empty then
  201.       send mouseUp to bg btn hiButton
  202.     end if
  203.     pass idle
  204.   end if
  205.  
  206.   -- CHECK POWERKEYS
  207.   if the powerKeys is true and the visible of message window is false then
  208.     put InKey() into trapChar
  209.   else
  210.     exit idle
  211.   end if
  212.  
  213.   -- TRAPPING RETURN
  214.   if trapChar = return then
  215.     if the visible of bg btn "Sort" is true then
  216.       send mouseUp to bg btn "Sort"
  217.       exit idle
  218.     end if
  219.     global hiButton,findIt
  220.     set cursor to 4
  221.     if hiTapeButton is empty then
  222.       send mouseUp to bkgnd btn id 132
  223.       exit idle
  224.     else
  225.       send mouseUp to bkgnd btn hiTapeButton
  226.       exit idle
  227.     end if
  228.   end if
  229.  
  230.   -- TRAPPING ENTER:
  231.   if chartonum(trapChar) = 3 then
  232.     if the short name of bg btn id 153 = "Edit ON" then
  233.       send mouseUp to bg btn id 153
  234.     end if
  235.     if the tool is "browse tool"
  236.     then choose button tool
  237.   else if the tool is "button tool"
  238.   then choose field tool
  239. else choose browse tool
  240. exit idle
  241. end if
  242.  
  243. -- TRAPPING LEFT ARROWS:
  244. if chartonum(trapChar) = 28 then
  245.   send mouseUp to bg btn "Prev"
  246.   exit idle
  247. end if
  248.  
  249. -- TRAPPING RIGHT ARROWS
  250. if chartonum(trapChar) = 29 then
  251.   send mouseUp to bg btn "Next"
  252.   exit idle
  253. end if
  254.  
  255. -- IF CLASS INDEX IS SHOWING GET OUT:
  256. if hiButton = 33 then exit idle
  257.  
  258. -- TRAPPING UP ARROWS
  259. if chartonum(trapChar) = 30 then
  260.   send mouseUp to bkgnd btn "up"
  261.   exit idle
  262. end if
  263.  
  264. -- TRAPPING DOWN ARROWS
  265. if chartonum(trapChar) = 31 then
  266.   send mouseUp to bkgnd btn "down"
  267.   pass idle
  268. end if
  269.  
  270. if chartonum(trapChar) ‚â• 97 and ¬¨   -- LOWER CASE
  271. charToNum(trapChar) ‚⧠122 then      -- ALPHAS
  272.  
  273. -- FIND OUT LINE NUMBER OF MASTER THAT TRAPCHAR IS ON:
  274. put char 1 to offset("‚àÇ" & trapchar,master) of master into firstLines
  275. put the number of lines in firstLines into lineNo
  276.  
  277. -- POSITION THE TRAPCHAR LINE + 11
  278. lock screen
  279. put line lineNo to lineNo + 11 of master into field "window"
  280. unlock screen with visual dissolve fast
  281. put empty into trapChar
  282. exit idle
  283.  
  284. end if
  285.  
  286. End IDLE
  287.  
  288. -------------------
  289. -- MORE TRAPPING --
  290. -------------------
  291.  
  292. On MOUSEDOWN
  293.  
  294.   -- CHECKING TO SEE IF AN INDEXED FIELD
  295.   -- WAS OPENED. IF SO, SEND CLOSE TO
  296.   -- ACTIVATE INDEX ADJUSTMENT.
  297.   global fieldIsOpen
  298.   if fieldIsOpen is empty then pass mouseDown
  299.   send closeField to fld fieldIsOpen
  300.   put empty into fieldIsOpen
  301.   pass mouseDown
  302.  
  303. End MOUSEDOWN
  304.  
  305. -------------------
  306. -- MORE TRAPPING --
  307. -------------------
  308.  
  309. On ARROWKEY whichArrow
  310.  
  311.   -- DECLARE GLOBALS:
  312.   global hiButton
  313.  
  314.   -- TRAP RIGHT ARROW:
  315.   if whichArrow = "right" then
  316.     send mouseUp to bg btn "Next"
  317.     exit arrowKey
  318.   end if
  319.  
  320.   -- TRAP LEFT ARROW:
  321.   if whichArrow = "left" then
  322.     send mouseUp to bg btn "Prev"
  323.     exit arrowkey
  324.   end if
  325.  
  326.   -- TRAP UP ARROW:
  327.   if whichArrow = "up" then
  328.     send mouseUp to bkgnd btn "up"
  329.   end if
  330.  
  331.   -- TRAP DOWN ARROW:
  332.   if whichArrow = "down" then
  333.     send mouseUp to bkgnd btn "down"
  334.   end if
  335.  
  336. End ARROWKEY
  337.  
  338. -------------------
  339. -- MORE TRAPPING --
  340. -------------------
  341.  
  342. On DOMENU whichItem
  343.  
  344.   -- DECLARE GLOBALS:
  345.   global nuCard,tempUL,tempPK,killCard
  346.  
  347.   -- TRAP THE FOUR MAJOR NAVIGATORS
  348.  
  349.   if whichItem = "FIRST" then
  350.     if the shiftKey is down then
  351.       -- ONLY WAY TO GET TO REAL FIRST CARD!
  352.       go to first card
  353.       exit doMenu
  354.     end if
  355.     lock screen
  356.     go to card 3  -- FIRST DATA CARD!
  357.     unlock screen with visual dissolve fast
  358.     exit doMenu
  359.   end if
  360.  
  361.   if whichItem = "PREV" then
  362.     if the number of this card is 3 then
  363.       go last  -- SKIPS FIRST TWO CARDS
  364.     else
  365.       go prev
  366.     end if
  367.     exit doMenu
  368.   end if
  369.  
  370.   if whichItem = "NEXT" then
  371.     if the number of this card = the number of cards then
  372.       go to card 3  -- SKIPS FIRST TWO CARDS
  373.     else
  374.       go next
  375.     end if
  376.     exit doMenu
  377.   end if
  378.  
  379.   if whichItem = "LAST" then
  380.     go last
  381.     exit doMenu
  382.   end if
  383.  
  384.   -- TRAP NEW CARD MENUITEM:
  385.   if whichItem = "New Card" then
  386.     if nuCard = 0 or nuCard is empty then
  387.       answer "Recommend using the NEW button on the VCR."
  388.       exit doMenu
  389.     end if
  390.   end if
  391.  
  392.   -- TRAP DELETE CARD MENUITEM:
  393.   if whichItem = "Delete Card" then
  394.     if killCard = 0 or killCard is empty then
  395.       answer "Recommend using the KILL button on the VCR."
  396.       exit doMenu
  397.     end if
  398.   end if
  399.  
  400.   -- TRAP CUT CARD MENUITEM:
  401.   if whichItem = "Cut Card" then
  402.     answer "No can do. Cutting cards messes up the index."
  403.     exit doMenu
  404.   end if
  405.  
  406.   -- TRAP COPY CARD MENUITEM:
  407.   if whichItem = "Copy Card" then
  408.     answer "Copying cards can mess up the index."
  409.     pass doMenu
  410.   end if
  411.  
  412.   -- TRAP PASTE CARD MENUITEM:
  413.   if whichItem = "Paste Card" then
  414.     answer "This card won't be indexed."
  415.     pass doMenu
  416.   end if
  417.  
  418.   -- TRAP NEW STACK MENUITEM:
  419.   if whichItem = "New Stack..." then
  420.  
  421.     -- GET THE NAME OF THE NEW VIDEOSTAK:
  422.     ask "What is the name of your new VideoStak?" with "VideoStak ‚óä Mine"
  423.     if IT is empty then exit doMenu
  424.  
  425.     -- ESTABLISH SOURCE/DESTINATION PATHNAME:
  426.     set cursor to 4
  427.     put it into newName
  428.     put the long name of this stack into levelName
  429.     delete char 1 to 7 of levelName
  430.     repeat with i = the number of chars in levelName down to 1
  431.       if char i of levelName = ":" then exit repeat
  432.       delete char i of levelName
  433.     end repeat
  434.     put levelName & "VideoStak ‚óä Don't Open 2" into sourceFile
  435.     put levelName & newName into destinationFile
  436.  
  437.     -- THE GUY DE PICCIOTTO COPY FILE XCMD:
  438.     copyfile sourceFile,destinationFile
  439.     put the result into errorCode
  440.     if errorCode = -2 then answer "Syntax error!"
  441.     if errorCode = -1 then answer "Not enough memory to copy!"
  442.     if errorCode =  1 then answer "Can't find VideoStak ‚óä Don't Open 2!"
  443.     if errorCode =  2 then answer "Can't create your new VideoStak file!"
  444.     if errorCode =  4 then answer "Error reading VideoStak ‚óä Don't Open 2!"
  445.     if errorCode =  5 then answer "Error writing your new VideoStak file!"
  446.     if errorCode =  3 then
  447.       answer newName && "already exists!" with "Copy Over" or "New Name" or "Cancel"
  448.       if IT = "Cancel" then exit doMenu
  449.       if IT = "New Name" then doMenu "New Stack..."
  450.       if IT = "Copy Over" then
  451.         set cursor to 4
  452.         copyfile sourceFile,destinationFile,o
  453.         put the result into errorCode
  454.         if errorCode = -2 then answer "Syntax error!"
  455.         if errorCode = -1 then answer "Not enough memory to copy!"
  456.         if errorCode =  1 then answer "Can't find VideoStak ‚óä Don't Open 2!"
  457.         if errorCode =  2 then answer "Can't create your new VideoStak file!"
  458.         if errorCode =  4 then answer "Error reading VideoStak ‚óä Don't Open 2!"
  459.         if errorCode =  5 then answer "Error writing your new VideoStak file!"
  460.         go to destinationFile
  461.         exit doMenu
  462.       end if
  463.     end if
  464.  
  465.     -- GO TO NEW VIDEOSTAK:
  466.     go to destinationFile
  467.     exit doMenu
  468.  
  469.   end if
  470.  
  471.   -- PASS THE DOMENU OR GET LOCKED OUT:
  472.   pass doMenu
  473.  
  474. End DOMENU
  475.  
  476. -------------------
  477. -- MORE TRAPPING --
  478. -------------------
  479.  
  480. On ENTERKEY
  481.  
  482.   -- TRAPPING ENTERKEY AS A TOOL TOGGLER:
  483.   if the tool is "browse tool"
  484.   then choose button tool
  485. else if the tool is "button tool"
  486. then choose field tool
  487. else choose browse tool
  488.  
  489. End ENTERKEY
  490.  
  491. -------------------
  492. -- CLOSING STUFF --
  493. -------------------
  494.  
  495. On CLOSECARD
  496.  
  497.   -- DECLARE GLOBALS:
  498.   global window,add2index,labelMaster
  499.  
  500.   -- MEMORIZE THE WINDOW FIELD & THEN DELETE:
  501.   put field "window" into window
  502.   put field "Label" into labelMaster
  503.   lock screen
  504.   put empty into field "window"
  505.   put empty into field "Label"
  506.  
  507. End CLOSECARD
  508.  
  509. ------------------
  510. -- MORE CLOSING --
  511. ------------------
  512.  
  513. On CLOSESTACK
  514.  
  515.   -- DECLARE GLOBALS:
  516.   global PK,UL,TA,BT,MW,cardNo,lineNo,master,hiButton
  517.   global hiTapeButton,window,installBtn,titleMaster
  518.   global starMaster,directorMaster,labelMaster
  519.  
  520.   -- IF CLOSING SEQUENCE IS APPROPRIATE, DO IT:
  521.   if the short name of this card ‚↠"Opening" then
  522.  
  523.     -- GET DATA NEEDED TO RESUME WHERE LEFT OFF:
  524.     set cursor to 4
  525.     put the number of this card into cardNo
  526.  
  527.     -- PUT CARDS INTO RAM SO RUN FAST
  528.     -- IN THE UNLOCKED CLOSING:
  529.     set lockmessages to true
  530.     go to card "Credits"
  531.     go to card "Opening"
  532.     go to card cardNo
  533.  
  534.     -- CLEAN OUT THE LAST CARD VIEWED:
  535.     put empty into fld "Window"
  536.     put empty into fld "Label"
  537.  
  538.     -- START UNLOCKED CLOSING:
  539.     go to card "Credits"
  540.     unlock screen with visual dissolve fast
  541.     put empty into fld "Window"
  542.     put empty into fld "Label"
  543.     play drawer
  544.     wait 20 ticks
  545.     lock screen
  546.     go to card "Opening"
  547.     unlock screen with visual dissolve fast
  548.     play TVStart
  549.     put empty into fld "Window"
  550.     put empty into fld "Label"
  551.     set lockmessages to false
  552.  
  553.   end if
  554.  
  555.   -- PUT VITAL VARIABLES INTO FIELDS:
  556.   put cardNo into card field "cardNo"
  557.   put lineNo into card field "lineNo"
  558.   put master into card field "master"
  559.   put titleMaster into card field "titleMaster"
  560.   put starMaster into card field "starMaster"
  561.   put directorMaster into card field "directorMaster"
  562.   put installBtn into card field "installBtn"
  563.   put labelMaster into card field "labelMaster"
  564.   put hiButton into card field "hiButton"
  565.  
  566.   -- PUT STUFF BACK THE WAY YOU FOUND IT:
  567.   set the userlevel to UL
  568.   set the powerKeys to PK
  569.   set the textArrows to TA
  570.   set the blindTyping to BT
  571.  
  572.   -- COMPACTION:
  573.   if the freeSize of this stack/the size of this stack > .2 then
  574.     answer "Want to compact the stack?" with "Yes" or "No"
  575.     if it = "Yes" then
  576.       go to this card
  577.       domenu "Compact Stack"
  578.     end if
  579.   end if
  580.  
  581.   -- THE EFFECT TO USE ON THE WAY OUT:
  582.   visual dissolve fast
  583.  
  584. End CLOSESTACK
  585.  
  586.  
  587.  
  588.  
  589.